package lesson5;

public class task10 {

	public static void main(String[] args) {
		
		int[] x = {5,6,9,3,0,0,7,4,3,5,4,8,3,3,2,5,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0};
		
		int[] helper = new int[10];//10 zeroes with indexes from 0 to 9
		
		for(int i = 0; i < x.length; i++)
		{
			int number = x[i];//the number in our array
			
			helper[number]++;
		}
		
		//find max value from helper
		int max = helper[0];
		int maxIdx = 0;
		for(int i = 1; i < helper.length; i++)
		{
			if(helper[i] > max)
			{
				max = helper[i];
				maxIdx = i;
			}
		}
		
		System.out.println("Most common number is = " + maxIdx + " ( " +max + " times)");
	}
}
